FROM golang:1.22-alpine AS builder

COPY . /src
WORKDIR /src


RUN go env -w GO111MODULE=on
RUN go env -w CGO_ENABLED=0
RUN go env -w GOOS=linux
RUN go env -w GOARCH=amd64
RUN go env -w GOPROXY="https://goproxy.cn"

RUN go mod tidy -compat=1.22

RUN go build -o main group_buy/groupbuy.go

FROM docker.io/alpine
COPY --from=builder  /src/main /go/
RUN cd /go/
#COPY --from=builder  /src/conf/ /go/conf/
WORKDIR /go/
RUN ls

RUN set -eux && sed -i 's/dl-cdn.alpinelinux.org/mirrors.ustc.edu.cn/g' /etc/apk/repositories
RUN apk add -U tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

CMD ./main

